<#include "/macro.include"/> 
<#include "/custom.include"/> 
<#assign className = table.className>   
<#assign classNameLower = className?uncap_first> 
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="util" tagdir="/WEB-INF/tags" %>

<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="/hiwetop_oper/head.jsp"></jsp:include>
	
	<title><#if (table.remarks?length>0)> ${table.remarks}</#if>列表</title>
	</head>

	<body id="body">
		<div class="query">
			<div class="head">
				<ol class="breadcrumb">
				  	<div class="btn-group" role="group" aria-label="oper">
					  <button type="button" class="btn sm btn-default" onclick="goAction('save');">新增</button>
					  <button type="button" class="btn sm btn-danger" onclick="action('del');">删除</button>
					</div>
				</ol>
			</div>

			<form class="navbar-form navbar-left" role="search">
				 <#list table.notPkColumns?chunk(4) as row>
				<#list row as column>
				<#if !column.htmlHidden>	
				<div class="form-group">
					<#if column.remarks?index_of("dict")!=-1>
				    <util:dict dictCode="${column.columnNameLower}" id="${column.columnNameLower}" value="" headerLabel="请选择${column.remarks?substring(column.remarks?index_of("t")+	1,column.remarks?index_of("("))}"/>
				    <#elseif column.remarks?contains("(")>
					<input type="text" class="form-control"  id="${column.columnNameLower}" name="${column.columnNameLower}"  placeholder="${column.remarks?substring(0,column.remarks?index_of("("))}">
					<#elseif (column.sqlTypeName == "BIGINT")>
					   <#if column.remarks?contains("(")>
				     <input type="text" class="form-control" id="${column.columnNameLower}" name="${column.columnNameLower}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'%y-%M-%d'})" placeholder="${column.remarks?substring(0,column.remarks?index_of("("))}">
				     	<#else>
				     <input type="text" class="form-control" id="${column.columnNameLower}" name="${column.columnNameLower}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'%y-%M-%d'})" placeholder="${column.remarks}">
				     	</#if>
					<#else>
					<input type="text" class="form-control"  id="${column.columnNameLower}" name="${column.columnNameLower}"  placeholder="${column.remarks}">
					</#if>
			    </div>
				</#if>
				</#list>
				</#list>	
			  <button type="button" class="btn sm btn-primary" id="search" >查询</button>
			  <button type="reset" class="btn sm btn-danger">清空</button>		
			</form>
			<div id="table"></div>
		</div>
	</body>
	<script type="text/javascript">
	var path = '<%=request.getContextPath()%>';
	
	$(init(pageNo,pageSize)); 
	$(function(){
		$('#search').click(function(){
			init(pageNo,pageSize);
		});
	});
	function init(pageNo,pageSize){
		if(!pageNo)pageNo=this.pageNo;
		if(!pageSize)pageSize=this.pageSize;
		$('#table').TABLE({
			dataUrl : path+"/oper/${classNameLower}/goList.do"  ,
			id:"table",
			ck:{column:"${table.pkColumn.columnNameLower}"},
			headArr : [
			    {column:"${table.pkColumn.columnNameLower}",display:"${table.pkColumn.remarks}",hidden:true}  ,
			   <#list table.columns as column>
				<#if column.isNotIdOrVersionField>
				<#if (column.sqlTypeName == "BIGINT")>
					<#if column.remarks?contains("(")>
				{column:"${column.columnNameLower}",display:"${column.remarks?substring(0,column.remarks?index_of("("))}",format:"yyyy-mm-dd hh:hm"}  ,
					<#else>
				{column:"${column.columnNameLower}",display:"${column.remarks}",format:"yyyy-mm-dd hh:hm"}  ,
					</#if>
				<#else>
					<#if column.remarks?index_of("dict")!=-1>
				{column:"${column.columnNameLower}",display:"${column.remarks?substring(column.remarks?index_of("t")+	1,column.remarks?index_of("("))}",dict:true}  ,
					<#elseif column.remarks?contains("(")>
				{column:"${column.columnNameLower}",display:"${column.remarks?substring(0,column.remarks?index_of("("))}"},
					<#else>
				{column:"${column.columnNameLower}",display:"${column.remarks}"},
					</#if>
				</#if>
				</#if>
				</#list>
			],
			ctrl:[
				  { func:"goAction('upload',%${table.pkColumn.columnNameLower}%,'上传')" , display:"<button type=\"button\" class=\"btn sm btn-success\">上传</button>"},
				  { func:"goAction('update',%${table.pkColumn.columnNameLower}%,'修改信息')" , display:"<button type=\"button\" class=\"btn sm btn-warning\">修改</button>"},
			      { func:"goAction('view',%${table.pkColumn.columnNameLower}%,'查看信息')" , display:"<button type=\"button\" class=\"btn sm btn-info\">查看</button>"}
			],
			dataParam : { 
				pageNo : pageNo,
				pageSize : pageSize,
				 <#list table.notPkColumns?chunk(4) as row>
				<#list row as column>
				<#if !column.htmlHidden>	
				${column.columnNameLower} : $('#${column.columnNameLower}').val(),
				</#if>
				</#list>
				</#list>	
			}
		});
	}
	
	//操作页面
	function getActionUrl(operType,id){
		var url ;
		if(operType=='save'){
			url = path + '/oper/${classNameLower}/goUpdate.do'; //iframe的url
		}else if(operType=='update'){
			url = path + '/oper/${classNameLower}/goUpdate.do?id='+id; //iframe的url
		}else if(operType=='del'){
			url = path + '/oper/${classNameLower}/doDel.do?ids='+id; //iframe的url
		}else if(operType=='view'){
			url = path + '/oper/${classNameLower}/goView.do?id='+id;
		}else if(operType=='upload'){
			url = path + '/oper/${classNameLower}/goUpload.do?id='+id;
		}
		return url;
	}
	</script>
</html>
